﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.MainModule.Entities;

namespace Application.MainModule.UserManagement
{
    public static class UserMapping
    {
        public static Customers ToDataModelUser(this UserDTO userToConvert)
        {
            if (userToConvert == null)
            {
                return null;
            }
            return new Customers()
            {
                CustomerId = userToConvert.CustomerId,
                AuthorizationId = userToConvert.AuthorizationId,
                CustomerName = userToConvert.CustomerName,
                CustomerEmail = userToConvert.CustomerEmail,
                CustomerPassword = userToConvert.CustomerPassword,
                IsRegister = userToConvert.IsRegister,
                IsActive = userToConvert.IsActive,
            };
        }

        public static UserDTO ToServiceUser(Customers dataUser)
        {
            if (dataUser == null)
            {
                return null;
            }
            return new UserDTO()
            {
                CustomerId = dataUser.CustomerId,
                AuthorizationId = dataUser.AuthorizationId,
                CustomerName = dataUser.CustomerName,
                CustomerEmail = dataUser.CustomerEmail,
                CustomerPassword = dataUser.CustomerPassword,
                IsRegister = dataUser.IsRegister,
                IsActive = dataUser.IsActive,
            };
        }
    }
}
